<template>
  <span>
    <component
      v-if="isCustom"
      ref="isComponent"
      :is="typeName"
      :name="name"
      :initFunc="initFunc"
      @sure="handlerSure"
    ></component>
    <span v-else :title="name">{{ name }}</span>
  </span>
</template>

<script>
import LabelAndInput from './LabelAndInput.vue'

export default {
  props: {
    initFunc: Function, // 自定义组件初始化函数
    isCustom: Boolean,
    typeName: String,
    name: String
  },
  components: {
    LabelAndInput
  },
  data() {
    return {}
  },
  methods: {
    handlerSure(params) {
      this.$emit('sure', params)
    },
    initComponentV() {
      this.$refs.isComponent.initV()
    }
  }
}
</script>
